package com.liangtian.mdm.dm.group.model;

import java.io.Serializable;

public class AttrGroup implements Serializable, Comparable<AttrGroup> {
    private static final long serialVersionUID = -5260070525907976019L;

    private String id;                //am_attr_config.id
    private String modelId;        //模型id
    private String groupName;        //属性组名称
    private Integer position;        //属性组的顺序

    private Long groupId;        //属性组ID
    private Integer groupOrder;        //属性在属性组中的顺序
    private String attrId;            //属性ID
    private String attrName;        //属性名称
    private Integer isDefaultView;    //属性组是否默认显示

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getModelId() {
        return modelId;
    }

    public void setModelId(String modelId) {
        this.modelId = modelId;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public Integer getPosition() {
        return position;
    }

    public void setPosition(Integer position) {
        this.position = position;
    }

    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    public Integer getGroupOrder() {
        return groupOrder;
    }

    public void setGroupOrder(Integer groupOrder) {
        this.groupOrder = groupOrder;
    }

    public String getAttrId() {
        return attrId;
    }

    public void setAttrId(String attrId) {
        this.attrId = attrId;
    }

    public String getAttrName() {
        return attrName;
    }

    public void setAttrName(String attrName) {
        this.attrName = attrName;
    }

    // 排序
    @Override
    public int compareTo(AttrGroup o) {
        return this.getPosition() - o.getPosition();
    }

    // 去重
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;

        AttrGroup other = (AttrGroup) obj;

        if (groupId == null && other.groupId != null)
            return false;
        else if (groupId != null && other.groupId == null)
            return false;
        else if (groupId != null && other.groupId != null && !groupId.equals(other.groupId))
            return false;

        if (modelId == null && other.modelId != null)
            return false;
        else if (modelId != null && other.modelId == null)
            return false;
        else if (modelId != null && other.modelId != null && !modelId.equals(other.modelId))
            return false;

//		if (modelId != other.modelId)
//			return false;

        return true;
    }

    public Integer getIsDefaultView() {
        return isDefaultView;
    }

    public void setIsDefaultView(Integer isDefaultView) {
        this.isDefaultView = isDefaultView;
    }


}
